#include <stdio.h>
#include <stdlib.h>

int un_gval;
int init_gval=100;

int main()
{
    printf("code addr: %p\n", main); //用main函数代表代码区的地址
    const char* str = "hello linux";
    printf("read only char addr: %p\n", str);
    printf("init global value addr: %p\n", &init_gval);
    printf("uninit global value addr: %p\n", &un_gval);
  
    char* heap1 = (char*)malloc(100);
    char* heap2 = (char*)malloc(100);
    char* heap3 = (char*)malloc(100);
    char* heap4 = (char*)malloc(100);
    printf("heap1 addr: %p\n", heap1);
    printf("heap2 addr: %p\n", heap2);
    printf("heap3 addr: %p\n", heap3);
    printf("heap4 addr: %p\n", heap4);

    printf("stack addr: %p\n", &str); 
    printf("stack addr: %p\n", &heap1); 
    printf("stack addr: %p\n", &heap2);
    printf("stack addr: %p\n", &heap3);
    printf("stack addr: %p\n", &heap4); 
    return 0;
}

